Parallel testing for faster local testing [Deprecated]#349
Parallel testing for faster local testing [Deprecated]#349
Conversation
|
@copilot fix precommit-ci errors: |
There was a problem hiding this comment.
Pull request overview
This PR aims to speed up local development workflows by enabling parallel pytest execution (via pytest-xdist), adding retry support for flaky tests, and documenting the test suite / parallel execution behavior.
Changes:
- Add pytest-xdist + pytest-rerunfailures to the base test requirements.
- Introduce new pytest fixtures/configuration intended to improve isolation when running tests in parallel (SQL schema isolation, per-worker cache dirs).
- Extend
scripts/test-local.shand add test-suite documentation undertests/README.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
tests/requirements.txt |
Adds dependencies for parallel runs / flaky retries (but currently drops an async dependency needed by the suite). |
tests/conftest.py |
Adds fixtures/options to support parallel-safe execution across backends (SQL schema + cache-dir isolation). |
tests/README.md |
Adds comprehensive test-suite and parallel-execution documentation. |
scripts/test-local.sh |
Adds -p/-w support and attempts to split out serial local tests while running the rest in parallel. |
pyproject.toml |
Updates pytest/coverage configuration and adds a Black config section. |
Comments suppressed due to low confidence (1)
tests/conftest.py:240
- The custom
--parallel/--parallel-workersoptions are added here but aren’t used anywhere (no hook that converts them into xdist’s-nbehavior). As a result, runningpytest --parallelwill not actually run tests in parallel. Either implement the wiring (e.g., translate these options into-n) or drop these custom options to avoid a misleading CLI.
default="auto",
help="Number of parallel workers (default: auto)",
)
for more information, see https://pre-commit.ci
* Initial plan * Fix SIM108: use ternary operator for cache_dir assignment in conftest.py Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…flow (#351) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com>
* Fix SQL test module path in conftest.py fixture Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com> * Initial plan --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com>
…354) * Initial plan * Extend isolated_cache_directory fixture to cover maxage-marked tests Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com>
* Initial plan * Add pytest-asyncio back to tests/requirements.txt Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com>
) * Initial plan * Fix regression: only apply cache isolation in parallel (xdist) mode Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com> * Apply ruff format to conftest.py to fix pre-commit.ci formatting error Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shaypal5 <917954+shaypal5@users.noreply.github.com>
|
@Borda Hey! Please take a look and review. :) |
|
@copilot why don't you run parallel tests also in CI? |
|
@shaypal5 seems pre-commit bot is disabled so not linting fixes are pusched to the PR |
* Initial plan * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add parallel test execution (-n auto) to CI workflow Co-authored-by: Borda <6035284+Borda@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Borda <6035284+Borda@users.noreply.github.com>
|
Hey @Borda , please let's finish parallel test execution for local running first, then open a separate PR for its use in the CI. Please roll back this branch to commit 4a4f2ca, which passed and for which I asked you for a review, and then review it so we can merge it. Then, you can cherry pick your newer commits to a new branch out of this branch or main, and open a PR when this actually works in the CI. :) |
|
Nevermind. Please review PR #360 . |
This pull request introduces parallel test execution support to the testing infrastructure, improving test speed and reliability. It adds new pytest fixtures and configuration to enable safe parallelization, including worker-specific isolation for SQL and cache-based tests. The test runner script (
test-local.sh) is enhanced with options for parallel execution, and the test dependencies are updated accordingly.Key changes include:
Parallel Test Execution Support:
pytest-xdistand related plugins totests/requirements.txtto enable parallel test execution and automatic retries for flaky tests.-p/--parallel,-w/--workers) inscripts/test-local.shto run tests in parallel and specify the number of workers. The script now installspytest-xdistif needed and handles serial vs. parallel test execution, including special handling for pickle and memory tests. [1] [2] [3] [4] [5] [6] [7] [8] [9]Test Isolation and Fixtures:
tests/conftest.pywith fixtures for:Configuration Updates:
pyproject.toml:tool.blackconfiguration for consistent formatting.These changes collectively make the test suite faster, more robust, and ready for parallel execution, especially important for large or slow-running test suites.